package com.honghu.villagepost.dao.data.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

import com.homghu.villagepost.DaoMaster;

/**
 * Created by liyu on 2017/1/2.
 * <p>
 * IM 数据库升级处理
 */

public class DatabaseOpenHelper extends DaoMaster.OpenHelper {

    public DatabaseOpenHelper(Context context, String name, CursorFactory factory) {
        super(context, name, factory);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        DatabaseConfig.configDatabase();
        try {
            for (DatabaseUpgrade upgrade : DatabaseRegistry.getUpgrades()) {
                upgrade.checkUpgrade(db, oldVersion, newVersion);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
